package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.CheckOutSetlDetail;
import com.eling.elcms.travel.service.ICheckOutSetlDetailManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CheckOutSetlDetailController extends BaseFormController{

	@Autowired
	private ICheckOutSetlDetailManager checkOutSetlDetailManager;
	
	@RequestMapping("/api/checkoutsetldetail/save")
    @ResponseBody
	public CheckOutSetlDetail save(@ModelAttribute@ModelFilling CheckOutSetlDetail cond){
		return checkOutSetlDetailManager.save(cond);
	}
	
	@RequestMapping("/api/checkoutsetldetail/{pkCheckOutSetlDetail}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkCheckOutSetlDetail){
		checkOutSetlDetailManager.remove(pkCheckOutSetlDetail);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/checkoutsetldetail/queryCheckOutDetail")
    @ResponseBody
	public List<CheckOutSetlDetail> queryCheckOutDetail(@ModelAttribute CheckOutSetlDetail cond){
		return checkOutSetlDetailManager.queryCheckOutDetail(cond);
	}
	
	@RequestMapping("/api/checkoutsetldetail/search*")
	@ResponseBody
	public List<CheckOutSetlDetail> search(@ModelAttribute SearchCondition sc,@ModelAttribute CheckOutSetlDetail cond){
		sc.setQueryCondition(cond);
		return checkOutSetlDetailManager.search(sc);
	}
	
}
